package com.nanfang51g3.ckz.adapter.ext;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.nanfang51g3.ckz.R;
import com.nanfang51g3.ckz.adapter.base.BaseRecyclerViewAdapter;
import com.nanfang51g3.ckz.domain.IndexBean;

import java.util.List;

/**
 * Created by Administrator on 2016/4/19.
 */
public class IndexAdapter extends BaseRecyclerViewAdapter<IndexBean, IndexAdapter.IndexViewHolder> {

    public IndexAdapter(List<IndexBean> list) {
        super(list);
    }


    @Override
    protected void bindDataToItemView(IndexViewHolder myViewHolder, IndexBean item) {
        ImageView imageView = myViewHolder.getView(R.id.index_item_iv);
        Glide.with(super.getActivity()).load(item.getImage())
                .placeholder(R.mipmap.ic_item)
                .into(imageView);
        myViewHolder.setText(R.id.index_item_title, item.getImage_title());
        myViewHolder.setText(R.id.tv_index_item_reward, item.getTotal() + "");//悬赏金额
        myViewHolder.setText(R.id.tv_index_brought, item.getMoney() + "");//已领金额
        myViewHolder.setText(R.id.tv_index_item_price, item.getPrice() + "");//分享收益


    }


    @Override
    public IndexViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) {

        return new IndexViewHolder(inflateItemView(viewGroup, R.layout.index_item));

    }

    public class IndexViewHolder extends BaseRecyclerViewAdapter.SparseArrayViewHolder {
        public IndexViewHolder(View itemView) {
            super(itemView);
        }
    }

}
